﻿
using Maticsoft.BLL;
using Maticsoft.DBUtility;
using Maticsoft.Model;

using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using Wuqi.Webdiyer;

public partial class WebPage_Index_CaiwuJilu : HelpBBasePage
{

    public Maticsoft.BLL.Flow flowbll = new Maticsoft.BLL.Flow();
    public Maticsoft.Model.Flow flowmodel = new Maticsoft.Model.Flow();

    public string type = "store";
    public Maticsoft.BLL.UserInfo userbll = new Maticsoft.BLL.UserInfo();
    public Maticsoft.Model.UserInfo usermodel = new Maticsoft.Model.UserInfo();

    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        this.getJilu();
    }

    private void getJilu()
    {
        int num;
        StringBuilder builder = new StringBuilder();
        StringBuilder builder2 = new StringBuilder();
        Maticsoft.BLL.UserInfo info = new Maticsoft.BLL.UserInfo();
        this.Literal1.Text = Maticsoft.BLL.Flow.GetHead(this.type).ToString();
        if (this.type == "charge")
        {
            this.sqlWhere = " Order_id=0 ";
            Pagers pagers = DbHelperSQL.SelectByPager("*", "Order_id=0", "Create_time desc", this.AspNetPager1.CurrentPageIndex, this.AspNetPager1.PageSize, "Pay", "", "");
            if (pagers.MyData.Rows.Count > 0)
            {
                for (num = 0; num < pagers.MyData.Rows.Count; num++)
                {
                    DataRow row = pagers.MyData.Rows[num];
                    string[] strArray = row["Id"].ToString().Split(new char[] { 'a' });
                    string[] strArray2 = row["Id"].ToString().Replace("as", ",").Split(new char[] { ',' });
                    Maticsoft.Model.UserInfo model = new Maticsoft.Model.UserInfo();
                    model = info.GetModel(Convert.ToInt32(strArray2[1].ToString()));
                    if ((num % 2) != 0)
                    {
                        builder2.Append("<tr>");
                    }
                    else
                    {
                        builder2.Append("<tr class='alt'>");
                    }
                    if (model != null)
                    {
                        builder2.Append("<td width='200'>" + model.Email + "/" + model.Username + "</td>");
                    }
                    builder2.Append("<td width='100'>在线充值</td>");
                    builder2.Append("<td width='160'>" + row["Money"] + "</td>");
                    builder2.Append("<td width='200'>" + row["Bank"] + "</td>");
                    builder2.Append("<td width='200'>" + row["Create_time"] + "</td>");
                    builder2.Append("</tr>");
                }
            }
        }
        else
        {
            int num2;
            List<Maticsoft.Model.Flow> list = new List<Maticsoft.Model.Flow>();
            list = this.flowbll.SearchFlow(this.AspNetPager1.PageSize, this.AspNetPager1.CurrentPageIndex, "*", "order by Create_time desc", this.sqlWhere, out num2);
            this.AspNetPager1.RecordCount = num2;
            this.pages = this.AspNetPager1.CurrentPageIndex;
            num = 0;
            foreach (Maticsoft.Model.Flow flow in list)
            {
                builder2.Append(Maticsoft.BLL.Flow.GetContent(flow.User_id, this.type, flow.Money, flow.Admin_id, flow.Create_time, flow.Detail_id, num));
                num++;
            }
        }
        this.Literal2.Text = builder2.ToString();
    }

    public string GetStyle(string s, string style)
    {
        string str = "";
        if (s == style)
        {
            str = "class='current'";
        }
        return str;
    }

    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        this.HeaderControl1.Select = "index";
        if (base.Request.QueryString["s"] != null)
        {
            this.type = base.Request.QueryString["s"].ToString();
            this.sqlWhere = " Action='" + this.type + "'";
        }
        this.getJilu();
    }

    public int pages
    {
        get
        {
            if (this.ViewState["pages"] != null)
            {
                return Convert.ToInt32(this.ViewState["pages"].ToString());
            }
            return 1;
        }
        set
        {
            this.ViewState["pages"] = value;
        }
    }

    public string sqlWhere
    {
        get
        {
            if (this.ViewState["sqlWhere"] != null)
            {
                return this.ViewState["sqlWhere"].ToString();
            }
            return " Action='store'";
        }
        set
        {
            this.ViewState["sqlWhere"] = value;
        }
    }
}

